﻿@import "compass/utilities/sprites/base";

// General Sprite Defaults
// You can override them before you import this file.
$sliding-sprite-base-class: ".desktop-sliding" !default;
$sliding-sprite-dimensions: false !default;
$sliding-position: 0% !default;
$sliding-spacing: 0 !default;
$sliding-repeat: no-repeat !default;
$sliding-prefix: "" !default;

// These variables control the generated sprite output
// You can override them selectively before you import this file.

// @import "default_sliding/*.png";
$sliding-sprites: sprite-map("default_sliding/*.png", $spacing: 10px);

// All sprites should extend this class
// The sliding-sprite mixin will do so for you.
// #test{background: $sliding-sprites no-repeat;}

#{$sliding-sprite-base-class} {
  //background: $sliding-sprites no-repeat;
  background: url(images/sliding.png) no-repeat 0 0;
}

// Use this to set the dimensions of an element
// based on the size of the original image.
@mixin sliding-sprite-dimensions($name) {
  @include sprite-dimensions($sliding-sprites, unquote($name));
}

// Move the background position to display the sprite.
@mixin sliding-sprite-position($name, $offsetX: 0, $offsetY: 0) {
  @include sprite-background-position($sliding-sprites, unquote($name), $offsetX, $offsetY);
}

// Extends the sprite base class and set the background position for the desired sprite.
// It will also apply the image dimensions if $dimensions is true.
@mixin sliding-sprite($name, $dimensions: $sliding-sprite-dimensions, $offsetX: 0, $offsetY: 0) {
  @extend #{$sliding-sprite-base-class};

  @if $name {
    @include sprite($sliding-sprites, unquote($name), $dimensions, $offsetX, $offsetY);
  }
}

@mixin sliding-sprites($sprite-names, $dimensions: $sliding-sprite-dimensions, $prefix: sprite-map-name($sliding-sprites)) {
  @include sprites($sliding-sprites, $sprite-names, $sliding-sprite-base-class, $dimensions, $prefix);
}

// Generates a class for each sprited image.
//@mixin all-sliding-sprites($dimensions: $sliding-sprite-dimensions, $prefix: sprite-map-name($sliding-sprites)) {
//  @include sliding-sprites(, $dimensions, $prefix);
//}

@mixin sliding($sliding: false, $offsetX: 0, $offsetY: 0, $dimension: false, $action: $sliding-bg, $pos: false, $rep: false) {
  @if $action == true {
    @if $pos == true {
      @include sliding-sprite-position($sliding, $offsetX, $offsetY);
    }

    @else {
      @include sliding-sprite($sliding, $dimension, $offsetX, $offsetY);
    }
  }

  @else {
    background: url("images/" + $sliding + ".png") if($rep, $req, no-repeat) $offsetX $offsetY;
  }
}